﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public partial class UIEXART : ViewBase
    {
        
        public void ResetSeq(object sender, RoutedEventArgs e)
        {
            if (!TMV.IsITX)
            {
                return;
            } 
        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            base.Window_Loaded(sender, e);
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            if (dwMaster == null)
            {
                KEY = "";

            }
            else
            {
                KEY = TMV.ARTICLE;
                CODE = TMV.CODE;
                BOOK = TMV.BOOK;
                LOCATION = TMV.LOCATION;
                WEIGHT = TMV.WEIGHT;
                WIDTH = TMV.WIDTH;
                CUSTOMERPRICE = TMV.CUSTOMERPRICE;
                COMPOSITION = TMV.COMPOSITION; 
            }
        }
    }
    public partial class UIEXART
    {
        #region ==REMARK===========
        public static readonly DependencyProperty REMARKProperty = DependencyProperty.Register("REMARK",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnREMARKChanged));
        public string REMARK
        {
            get
            {
                return (string)GetValue(REMARKProperty);
            }
            set
            {
                SetValue(REMARKProperty, value);
                
            }
        }
        private static void OnREMARKChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.REMARK = (string)e.NewValue;
                src.OnRemarkChg();
            }
        }
        public void OnRemarkChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["REMARK"] = REMARK;
            if (dwMain == null)
            { }
        }
        #endregion

        #region ==SUPPLIER===========
        public static readonly DependencyProperty SUPPLIERProperty = DependencyProperty.Register("SUPPLIER",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSUPPLIERChanged));
        public string SUPPLIER
        {
            get
            {
                return (string)GetValue(SUPPLIERProperty);
            }
            set
            {
                SetValue(SUPPLIERProperty, value);
               
            }
        }
        private static void OnSUPPLIERChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.SUPPLIER = (string)e.NewValue;
                src.OnSUPPLIERChg();
            }
        }
        public void OnSUPPLIERChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["SUPPLIER"] = SUPPLIER;
            if (dwMain == null)
            { }
        }
        #endregion

        #region ==CODE===========
        public static readonly DependencyProperty CODEProperty = DependencyProperty.Register("CODE",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnCODEChanged));
        public string CODE
        {
            get
            {
                return (string)GetValue(CODEProperty);
            }
            set
            {
                SetValue(CODEProperty, value);

            }
        }
        private static void OnCODEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.CODE = (string)e.NewValue;
                src.OnCODEChg();
            }
        }
        public void OnCODEChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["CODE"] = CODE;
            if (dwMain == null)
            { }
        }
        #endregion
        #region ==BOOK===========
        public static readonly DependencyProperty BOOKProperty = DependencyProperty.Register("BOOK",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnBOOKChanged));
        public string BOOK
        {
            get
            {
                return (string)GetValue(BOOKProperty);
            }
            set
            {
                SetValue(BOOKProperty, value);

            }
        }
        private static void OnBOOKChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.BOOK = (string)e.NewValue;
                src.OnBOOKChg();
            }
        }
        public void OnBOOKChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["BOOK"] = BOOK;
            if (dwMain == null)
            { }
        }
        #endregion
        #region ==LOCATION===========
        public static readonly DependencyProperty LOCATIONProperty = DependencyProperty.Register("LOCATION",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnLOCATIONChanged));
        public string LOCATION
        {
            get
            {
                return (string)GetValue(LOCATIONProperty);
            }
            set
            {
                SetValue(LOCATIONProperty, value);

            }
        }
        private static void OnLOCATIONChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.LOCATION = (string)e.NewValue;
                src.OnLOCATIONChg();
            }
        }
        public void OnLOCATIONChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["LOCATION"] = LOCATION;
            if (dwMain == null)
            { }
        }
        #endregion
        #region ==COMPOSITION===========
        public static readonly DependencyProperty COMPOSITIONProperty = DependencyProperty.Register("COMPOSITION",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnCOMPOSITIONChanged));
        public string COMPOSITION
        {
            get
            {
                return (string)GetValue(COMPOSITIONProperty);
            }
            set
            {
                SetValue(COMPOSITIONProperty, value);

            }
        }
        private static void OnCOMPOSITIONChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.COMPOSITION = (string)e.NewValue;
                src.OnCOMPOSITIONChg();
            }
        }
        public void OnCOMPOSITIONChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["COMPOSITION"] = COMPOSITION.PadRight(72).Substring(0,72);
            if (dwMain == null)
            { }
        }
        #endregion

        #region ==WEIGHT===========
        public static readonly DependencyProperty WEIGHTProperty = DependencyProperty.Register("WEIGHT",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnWEIGHTChanged));
        public string WEIGHT
        {
            get
            {
                return (string)GetValue(WEIGHTProperty);
            }
            set
            {
                SetValue(WEIGHTProperty, value);

            }
        }
        private static void OnWEIGHTChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.WEIGHT = (string)e.NewValue;
                src.OnWEIGHTChg();
            }
        }
        public void OnWEIGHTChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["WEIGHT"] = WEIGHT;
            if (dwMain == null)
            { }
        }
        #endregion

        #region ==WIDTH===========
        public static readonly DependencyProperty WIDTHProperty = DependencyProperty.Register("WIDTH",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnWIDTHChanged));
        public string WIDTH
        {
            get
            {
                return (string)GetValue(WIDTHProperty);
            }
            set
            {
                SetValue(WIDTHProperty, value);

            }
        }
        private static void OnWIDTHChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.WIDTH = (string)e.NewValue;
                src.OnWIDTHChg();
            }
        }
        public void OnWIDTHChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["WIDTH"] = WIDTH;
            if (dwMain == null)
            { }
        }
        #endregion

        #region ==CUSTOMERPRICE===========
        public static readonly DependencyProperty CUSTOMERPRICEProperty = DependencyProperty.Register("CUSTOMERPRICE",
            typeof(string), typeof(UIEXART),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnCUSTOMERPRICEChanged));
        public string CUSTOMERPRICE
        {
            get
            {
                return (string)GetValue(CUSTOMERPRICEProperty);
            }
            set
            {
                SetValue(CUSTOMERPRICEProperty, value);

            }
        }
        private static void OnCUSTOMERPRICEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIEXART;
            if (src != null)
            {
                src.CUSTOMERPRICE = (string)e.NewValue;
                src.OnCUSTOMERPRICEChg();
            }
        }
        public void OnCUSTOMERPRICEChg()
        {
            if (dwMaster == null)
                return;
            dwMaster["CUSTOMERPRICE"] = CUSTOMERPRICE;
            if (dwMain == null)
            { }
        }
        #endregion

        public VICC_EXART TMV
        {
            get
            {
                return (VICC_EXART)MV;
            }
        }
      
    }
}
